#ifndef MODELSOLVER_H_
#define MODELSOLVER_H_
#include <string>
#include <list>
#include "../database/ConstraintDb.h"
#include "../database/ParameterDb.h"
#include "../database/PointDb.h"
#include "../database/PrimitiveDb.h"

namespace common {

class ModelSolver {

protected:

	PointDb* pointDb;
	PrimitiveDb* primitiveDb;
	ConstraintDb* constraintDb;
	ParameterDb* parameterDb;
	std::list<std::string> messages;

	void addMsg(const std::string& message);

public:
	ModelSolver();

	void setPointDb(PointDb* points);

	void setPrimitiveDb(PrimitiveDb* primitives);

	void setConstraintDb(ConstraintDb* constraints);

	void setParameterDb(ParameterDb* parameters);

	/**
	 * Solve system of equation based on constructor databases
	 */
	virtual void solve();

	/**
	 * Relax forces in Primitives elements
	 */
	virtual void relax();

	/**
	 * Return messages for last run of solver
	 */
	std::list<std::string> getMessages();

	virtual ~ModelSolver();
};

}

#endif /* MODELSOLVER_H_ */
